Skip to content

Load editor examples from ComlineProject/examples - #46

Merged
Kinflou merged 1 commit into
masterfrom
feat/examples-from-git
Sep 3, 2026
Merged

Load editor examples from ComlineProject/examples#46
Kinflou merged 1 commit into
masterfrom
feat/examples-from-git

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 3, 2026

Copy link
Copy Markdown
Member

Replaces the single inline SAMPLE_FILES schema with a set of real,
compilable example projects served from a new repo.

ComlineProject/examples

A git dependency — .ids projects, each a directory with a meta.json
(title / blurb / entry / order) and its files. bundle.mjs (run in
prepare / prepack, pure Node, no toolchain) walks them into one
examples.json; only that file ships (files in its package.json).

Four to start: chat (the old sample), key/value (a failable read +
writes), gateway (two protocols, for the forward-behaviour demo),
telemetry (fan-in over datagram, for the fault sliders). All verified
to compile against the current editor wasm.

Playground

  • import examples from "comline-examples" — no schema strings in
    main.ts.
  • Header Examples ▾ <select> swaps the whole file set; confirms first
    if you've made edits (dirty, set on onDocChanged).
  • Fresh visit opens examples[0] (chat) — unchanged behaviour.
  • src/examples.test.ts: every example compiles with zero diagnostics
    against this build's wasm, so comline-core grammar drift fails CI
    here. resolveJsonModule added; test glob → src/**.
  • .yarnrc.yml allows the new git repo; Yarn's cache holds the built
    archive so yarn install doesn't re-run the bundle unless the SHA moves.

24 tests pass (20 sim + 4 examples), yarn build green.

Depends on ComlineProject/examples existing (it does — pinned at
f638949). To add/edit an example: PR that repo, then bump the SHA here.

Drops the inline `SAMPLE_FILES` string. `comline-examples`
(github:ComlineProject/examples) is a git dependency of real `.ids`
projects — chat, key/value, gateway, telemetry — bundled to one JSON in
its `prepare`/`prepack`. `import examples from "comline-examples"`.

- an **Examples** `<select>` in the header swaps the whole file set; it
  confirms first if you've edited (`dirty` flag on `onDocChanged`).
- a fresh visit opens `examples[0]` (chat), same as before.
- `src/examples.test.ts` compiles every example against this build's editor
  wasm, so `comline-core` drift is caught here. `tsconfig.json` gains
  `resolveJsonModule`; the test glob widens to `src/**`.

24 tests pass (20 sim + 4 examples); `yarn build` green.
@Kinflou
Kinflou merged commit 28ce217 into master Sep 3, 2026
2 checks passed
@Kinflou
Kinflou deleted the feat/examples-from-git branch September 3, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant